from google.appengine.ext import db

class Greeting(db.Model):
  author = db.StringProperty(multiline=False)
  content = db.StringProperty(multiline=True)
  date = db.DateTimeProperty(auto_now_add=True)

class Register(db.Model):
  username = db.StringProperty(multiline=False)
  nickname = db.StringProperty(multiline=False)
  
class User_Topic(db.Model):
  username = db.StringProperty(multiline=False)
  topic = db.IntegerProperty()
  choice = db.StringProperty(multiline=False)
  
class Topic(db.Model):
  chart_type = db.StringProperty(multiline=False)
  question = db.StringProperty(multiline=False)
  date = db.DateTimeProperty(auto_now_add=True)
  sigle_choice = db.BooleanProperty()
  def remove(self):
      db.delete(self)

class Answer(db.Model):
  answer_desc = db.StringProperty(multiline=False)
  answer_order = db.IntegerProperty()
  votes = db.IntegerProperty()
  topic_id = db.ReferenceProperty(Topic, collection_name = 'answers')
  def remove(self):
      db.delete(self)
      
class Photo(db.Model):
  title = db.StringProperty(multiline=False)
  desc = db.StringProperty(multiline=True)
  data = db.BlobProperty()
  date = db.DateTimeProperty(auto_now_add=True)
  def remove(self):
      db.delete(self)